<?php
define('ABSPATH', dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))).'/'); 
require_once (ABSPATH . 'wp-load.php'); 
?>

<?php get_header();?>

<style type="text/css">
.add-new-h2 
{
	font-size: 13px
}

.row-actions {padding-top: 2px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; visibility: hidden}

tr:hover .row-actions {	visibility: visible}
</style>

<div>
	<h2>幻灯片 <a href="post-new.php" class="add-new-h2">新增幻灯片</a> </h2>

	<table width="914" border="1" align="center" cellpadding="0" cellspacing="0">
		<thead>
			<tr>
				<th width="20%" height="20" align="center" >
					<span>名称</span>
				</th>
				<th width="30%" height="20" align="center" >
					<span>描述(中文)</span>
				</th>
				<th width="30%" height="20" align="center" >
					<span>描述(英文)</span>
				</th>
				<th width="20%" height="20" align="center" >
					<span>启用</span>
				</th>
			</tr>
		</thead>
	 
	 	<tbody>
	 	<?php 
	 	
	 	$pager = new Pager(array(
	 				'table_name'=>'rd_slides',
	 				'current_page'=>$_GET['page'],
	 				'page_size'=>page_size));
	 	$slides_result = $wpdb->get_results("SELECT * FROM rd_slides order by id limit $pager->page_offset, $pager->page_size");
		if(count($slides_result)>0)
		{
			for($i = 0;$i<count($slides_result);$i++)
			{
				$slide = $slides_result[$i];
		?>
		
		<tr >
			<td align="center" valign="middle" slide_id='<?php echo $slide->id?>'>
				<a href=""><?php echo $slide->name_zh_CN ?></a>
				<div class="row-actions">
				<span><a href="">编辑</a> | </span>
				<span><a href="#">删除</a> | </span>
				</div>
			</td>			
			<td align="center" valign="middle"><?php echo $slide->description_zh_CN ?></td>
			<td align="center" valign="middle"><?php echo $slide->description_en_US ?></td>
			<td align="center" valign="middle"><?php echo display_boolean_value($slide->is_enable) ?></td>
		</tr>
		
		<?php
			}
		}
		?>
		</tbody>
	</table>
	<div align="right"><?php $pager->display()?></div>
</div>

<?php get_footer();?>     